<template>
  <div class="introduction-left">
    <span v-html="introductionHtml"></span>
  </div>
  <div class="introduction-right">
    <!-- history-wrapper 添加伪类小圆圈-->
    <div class="history-wrapper" v-for="(item, index) in data" :key="item.id">
      <div class="history-item">
        <span class="history-startYear">{{ item.startYear }}</span>
        <div class="history-details" style="padding-left: 14px">
          <div class="history-type">{{ item.type }}</div>
          <div class="history-content">
            {{ item.content }}
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { schoolHistoryApi } from '@/modules/InformationBase/api.js';
const { collegeCode, introduction } = defineProps({
  collegeCode: {
    type: String,
  },
  introduction: {
    type: String,
    default: '',
  },
});
const introductionHtml = introduction.replace(/\n/g, '<br>');
const data = ref([]);
schoolHistoryApi({ collegeCode: collegeCode }).then((res) => {
  data.value = res.data;
});
</script>

<style lang="scss" scoped>
.introduction-left {
  width: 70%;
  span:before {
    content: '    ';
  }
  span {
    font-size: 16px;
    font-weight: 400;
    color: #4e5969;
    line-height: 30px;
    white-space: pre-wrap;
  }
}
.introduction-right {
  flex: 1;
  padding-left: 30px;
  box-sizing: border-box;
}
.history-wrapper {
  -webkit-box-flex: 1;
  -ms-flex: 1;
  flex: 1;
  position: relative;
  left: 5px;
  border-left: 2px solid #e6e6e6;
  padding-bottom: 30px;
}
.history-wrapper:last-child {
  border-left: 2px solid white;
}
.history-wrapper::after {
  content: '';
  position: absolute;
  left: -6px;
  top: -9px;
  height: 10px;
  width: 10px;
  border: 2px solid #4080ff;
  border-radius: 100%;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}
.history-wrapper-margin::before {
  content: '';
  position: absolute;
  left: -6px;
  bottom: -9px;
  height: 10px;
  width: 10px;
  border: 2px solid #4080ff;
  border-radius: 100%;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}
.history-startYear {
  position: relative;
  height: 20px;
  bottom: 14px;
  left: 10px;
  border-radius: 2px;
  padding: 3px 5px;
  font-size: 12px;
  font-weight: 500;
  color: #fff;
  background-color: var(--primary-hover-color);
  line-height: 14px;
  display: inline-block;
  margin-bottom: 10px;
}
.history-type {
  color: var(--text-primary-color);
  font-size: 18px;
  line-height: 18px;
  font-weight: 500;
  margin-top: 0;
}
.history-content {
  color: var(--text-regular-color);
  font-size: 14px;
  line-height: 20px;
  font-weight: 400;
  margin-top: 10px;
}
</style>
